package ru.beta2.testyard.config;

import java.io.IOException;
import java.nio.ByteBuffer;

/**
 * Serialization handler convert messages from ByteBuffer to object and vice versa.
 * <br/>
 * Hint: use Hessian - language independent serialization - if your have not java client   
 * <br/>
 * User: Inc
 * Date: 18.01.2009
 * Time: 14:30:54
 */
public interface SerializationHandler
{

    /**
     * Convert message from {@code buf} to object
     * @param buf serialized representation of message
     * @return object representation of message
     * @throws IOException
     */
    public Object readObject(ByteBuffer buf) throws IOException;

    /**
     * Convert message from object to ByteBuffer
     * @param object object representation of message
     * @return serialized representation of message
     * @throws IOException
     */
    public ByteBuffer writeObject(Object object) throws IOException;

}
